//
//  ZGLScoreBoardViewController.m
//  ZeegingLottery
//
//  Created by 李曌 on 2018/10/18.
//  Copyright © 2018 蒂埃里. All rights reserved.
//

#import "ZGLScoreBoardViewController.h"
#import "MLMSegmentManager.h"
#import "ZGLScoreBContentController.h"

@interface ZGLScoreBoardViewController ()
{
    NSInteger segmentHeight;
    
}

@property (nonatomic, strong) UIView *segmentView;
@property (nonatomic, strong) UIView *contentBGView;

//@property (nonatomic, strong) NSArray *leagueNameArray;

@property (nonatomic, strong) MLMSegmentHead *segHead;
@property (nonatomic, strong) MLMSegmentScroll *segScroll;

@end

@implementation ZGLScoreBoardViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = ViewBackgroundColor;
    
    [self setupUI];
//    self.leagueNameArray = @[@"中超",@"英超",@"西甲",@"意甲",@"德甲",@"法甲",@"欧冠",@"欧联"];
}



#pragma mark - getter

- (void)setupUI
{
    NSArray *leagueNameArray = @[@"中超",@"英超",@"西甲",@"意甲",@"德甲",@"法甲",@"欧冠",@"欧联"];
    segmentHeight = 40;
    
    //头
    _segHead = [[MLMSegmentHead alloc]initWithFrame:CGRectMake(0, 5, UI_SCREEN_WIDTH, segmentHeight) titles:leagueNameArray headStyle:SegmentHeadStyleSlide layoutStyle:MLMSegmentLayoutDefault];
    _segHead.showIndex = 1;
    _segHead.slideHeight = 40 * .6;
    _segHead.fontSize = 14;
    _segHead.slideScale = .9;
    _segHead.selectColor = [UIColor whiteColor];
    _segHead.deSelectColor = mainTextColor;
    _segHead.slideColor = [UIColor redColor];
    _segHead.bottomLineColor = [UIColor lightGrayColor];
    
    //内容
    CGFloat y = CGRectGetMaxY(_segHead.frame);
    _segScroll = [[MLMSegmentScroll alloc]initWithFrame:CGRectMake(0, y, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT - y - STATUEHEIGHT - 35) vcOrViews:[self vcArr:leagueNameArray.count]];
    _segScroll.addTiming = SegmentAddScale;
    _segScroll.addScale = 0.1;
    _segScroll.loadAll = NO;
    
    //管理
    [MLMSegmentManager associateHead:_segHead withScroll:_segScroll completion:^{
        
        [self.view addSubview:self.segHead];
        [self.view addSubview:self.segScroll];
        
    }];
    
    
}

- (NSArray *)vcArr:(NSInteger)count {
    NSMutableArray *arr = [NSMutableArray array];
    for (NSInteger i = 0; i < count; i ++) {
        ZGLScoreBContentController *vc = [ZGLScoreBContentController new];
        vc.index = (i+1);
        [arr addObject:vc];
    }
    return arr;
}







@end
